Skip to content

WIP: Troubleshooting ModBus bit_sensor#2

Closed
yury-sannikov wants to merge 2 commits intodevfrom
bit_sensor_boilerplate
Closed

WIP: Troubleshooting ModBus bit_sensor#2
yury-sannikov wants to merge 2 commits intodevfrom
bit_sensor_boilerplate

Conversation

@yury-sannikov
Copy link
Copy Markdown
Owner

I'm trying to add a bit_sensor in addition to the binary_sensor
What I did:

  • copied over binary_sensor.py into the bit_sensor.py
  • added CONF_BIT_SENSORS constant
  • simplify async_setup_platform for sake of simplicity
  • copied over test_modbus_binary_sensor.py into the test_modbus_bit_sensor.py
  • trying to test bit sensor passing CONF_BIT_SENSORS as an array_name_discovery

I do not see that async_setup_platform method of the bit_sensor.py file called.

My goal is to make bit_sensor work side-by-side with the binary_sensor.

)
import homeassistant.helpers.config_validation as cv

from .bit_sensor import CONF_BIT_SENSORS
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Const belong in const.py (you might have created a round-around-robin here)

from .const import CALL_TYPE_COIL, CONF_INPUT_TYPE, MODBUS_DOMAIN
from .modbus import ModbusHub

CONF_BIT_SENSORS = "bit_sensors"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

belongs in const.py

_LOGGER = logging.getLogger(__name__)


async def async_setup_platform(
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will not be called, unless you add BIT_SENSOR/BIT_SENSORS to the loop in modbus.py (look for e.g. CLIMATE)

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 2, 2021

There hasn't been any activity on this pull request recently. This pull request has been automatically marked as stale because of that and will be closed if no further activity occurs within 7 days.
Thank you for your contributions.

@github-actions github-actions Bot added the stale label May 2, 2021
@github-actions github-actions Bot closed this May 9, 2021
@github-actions github-actions Bot locked and limited conversation to collaborators May 10, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants